<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('推荐药维护')" />
</head>
<body>
<div class="container-div">
	<div class="row">

		<div class="col-sm-12 search-collapse">
			<form id="post-form">
				<div class="select-list">
					<ul>
						<li>
							<input id="param1" th:title="测试" th:value="${key01}" ></input>
						</li>
					</ul>
					<ul>
						<li>
							药品类型：<select name="classname"  id="deviceType">
							<option value="">---请选择---</option>
							<option value="OTC呼吸系统">OTC呼吸系统</option>

							<option value="OTC解热镇痛">OTC解热镇痛</option>

							<option value="OTC其他类">OTC其他类</option>
							<option value="OTC其他类（内）">OTC其他类（内）</option>
							<option value="OTC清热解毒">OTC清热解毒</option>
							<option value="OTC外用（串味）">OTC外用（串味）</option>
							<option value="OTC外用药">OTC外用药</option>
							<option value="OTC五官科">OTC五官科</option>
							<option value="OTC消化系统">OTC消化系统</option>
							<option value="参茸">参茸</option>
							<option value="处方药">处方药</option>
							<option value="含麻黄碱专柜">含麻黄碱专柜</option>
							<option value="呼吸系统">呼吸系统</option>
							<option value="解热镇痛">解热镇痛</option>
							<option value="九珍堂">九珍堂</option>
							<option value="日用百货">日用百货</option>
							<option value="上虹">上虹</option>
							<option value="食品">食品</option>
							<option value="外用药">外用药</option>
							<option value="维生素">维生素</option>
							<option value="消化系统">消化系统</option>
							<option value="心血管">心血管</option>
							<option value="医疗器械">医疗器械</option>
							<option value="原研药">原研药</option>


						</select>
						</li>
<!--						<li>

						</li>
						&lt;!&ndash;<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;新增为关联</a>&ndash;&gt;
						<li>

						</li>-->

						<!--                        <li>
                                                    店内码：<input type="text" name="goodscode" th:placeholder="店内码"/>
                                                </li>
                                                <li>
                                                    拼音码：<input type="text" name="plucode" th:placeholder="条码"/>
                                                </li>
                                                <li>
                                                    商品名称：<input type="text" name="goodsname" th:placeholder="商品名称"/>
                                                </li>-->
						<!--                        <li>
                                                    客户名称：<input type="text" name="companyName"/>
                                                </li>-->
						<!--  <li>
                              岗位状态：<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
                              <option value="">所有</option>
                              <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                          </select>
                          </li>-->
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							<a class="btn btn-primary btn-rounded btn-sm pull-right" onclick=addRalationShip(1)><i class="fa"></i>新增为推荐</a>
							<a class="btn btn-warning btn-rounded btn-sm pull-right" onclick=addRalationShip(2)><i class="fa"></i>&nbsp;新增为关联</a>

						</li>
					</ul>
				</div>
			</form>
		</div>
		<!--
                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-success" onclick="$.operate.add()" >
                        <i class="fa fa-plus"></i> 新增
                    </a>
                    &lt;!&ndash;            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:post:edit">
                                    <i class="fa fa-edit"></i> 修改
                                </a>&ndash;&gt;
                    <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:post:remove">
                        <i class="fa fa-remove"></i> 删除
                    </a>
                    &lt;!&ndash;            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:post:export">
                                    <i class="fa fa-download"></i> 导出
                                </a>&ndash;&gt;
                </div>-->
		<div class="col-sm-12 select-table table-striped">
		<table id="bootstrap-table"></table>
	</div>


	<!--	<div class="col-sm-12 search-collapse">
			<form id="post-form2">
				<div class="select-list">

					<ul>

						<li>
							&lt;!&ndash;<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>新增为推荐</a>&ndash;&gt;
							<a class="btn btn-primary btn-rounded btn-sm" onclick=addRalationShip(1)><i class="fa"></i>新增为推荐</a>
							&lt;!&ndash;<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;新增为关联</a>&ndash;&gt;
							<a class="btn btn-warning btn-rounded btn-sm" onclick=addRalationShip(2)><i class="fa"></i>&nbsp;新增为关联</a>

						</li>
					</ul>
				</div>
			</form>
		</div>-->
	<!--    <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="post-form1">
                    <div class="select-list">
                        <ul>
                            <li>
                                药品信息：<input type="text" name="plucode" th:placeholder="店内码或拼音码"/>
                            </li>
                            &lt;!&ndash;                        <li>
                                                        客户名称：<input type="text" name="companyName"/>
                                                    </li>&ndash;&gt;
                            &lt;!&ndash;  <li>
                                  岗位状态：<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
                                  <option value="">所有</option>
                                  <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                              </select>
                              </li>&ndash;&gt;
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>-->

	<!--        <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" >
                    <i class="fa fa-plus"></i> 新增
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:post:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:post:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:post:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>-->

	<!--        <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table1"></table>
            </div>-->
</div>


<th:block th:include="include :: footer" />
<script th:inline="javascript">
	//  var editFlag = [[${@permission.hasPermi('system:post:edit')}]];
	// var removeFlag = [[${@permission.hasPermi('system:post:remove')}]];
	var datas = [[${@dict.getType('sys_normal_disable')}]];
	var prefix = ctx + "baodao/demo01";

	$(function() {
		var options = {
			url: prefix + "/list",
			createUrl: prefix + "/add",
			updateUrl: prefix + "/edit/{id}",
			removeUrl: prefix + "/remove",
			exportUrl: prefix + "/export",
			/*  sortName: "companyId",*/
			modalName: "药品关系",
			columns: [{
				checkbox: true
			},
				{
					field: 'goodscode',
					title: '商品码'
				},
				{
					field: 'goodsname',
					title: '商品名称'
				},
				/*                {
                                    field: 'mfrs',
                                    title: '生产企业'
                                },
                                {
                                    field: 'norm',
                                    title: '包装规则'
                                },*/
				/*                {
                                    field: 'plucode',
                                    title: '条码'
                                },*/

			]
		};
		$.table.init(options);
	});
</script>

<script>
 // 新增关联和推荐关系
	function addRalationShip(flag) {

		// 查询参数
/*		var  queryParams = {
			"companyId": $("#companyId").val(),"startTime": $("#startTime").val(), "endTime": $("#endTime").val(),"deviceType":$("#deviceType").val(),"legend": $("#deviceLegend").val(),
			"companyId2": $("#companyId2").val(),"deviceType2":$("#deviceType2").val(),"legend2": $("#deviceLegend2").val()
		}*/
		// 参数1
		var param1 = $("#param1").val();
		// 参数2
		var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
		if (rows.length == 0) {
			$.modal.alertWarning("请至少选择一条记录");
			return;
		}
		console.log("已选择数据数量：" + rows.length)
		console.log("已选择数据" + rows.toString())
		let id = rows.toString();
		var param2 = id;
		console.log("参数1：" + param1 + "参数2：" + param2 + "参数3：" + flag);
		$.ajax({
			type: 'post',
			url: ctx + 'baodao/demo01/addGoodLink',
			timeout: 30000,
		//	data : queryParams,
			data: {"key1":param1,"key2":param2,"flag":flag},
			dataType: 'json',
			success: function (data) {
				console.log(data);
				if(data.code == 0) {
					alert("数据插入成功")
				}else{
					alert("数据插入异常")
				}

			},
			error: function () {
				alert("调用数据接口失败,请联系管理员");
			}
		});
	}
</script>
</body>
</html>